package game.roles.gifts;

import game.roles.Role;
import game.roles.visual.BackgroundMaps;
import game.utils.ImageChange;
import game.utils.PressListenerOne;

import java.awt.*;

/**
 * @author 道具1，由小兵1进行掉落
 * 道具奖励
 */
public class Gift1 extends Role implements Gifts {

    public static Image[] giftImage;

    private ImageChange rm = new ImageChange(3);

    /**
     * 根据敌人的坐标生成奖品的位置
     */
    public Gift1(int x, int y) {
        super(x, y, 60, 60);
    }

    @Override
    public void rolesMove() {
        this.img = this.rm.change(giftImage);
        //相对静止
        if (!BackgroundMaps.mapMoveOrNot) {
            return;
        }
        if (PressListenerOne.isRight && BackgroundMaps.mapMoveOrNot) {
            this.x -= 2;
        } else if (!PressListenerOne.isRight) {
            this.x -= 1;
        }
    }
}
